package edu.gmu.messages;

import java.util.ArrayList;

public class ListManagerResponse implements edu.gmu.middleware.Message{
public ListManagerResponse() { }
public ListManagerRequest request;
public ArrayList<Host> hosts;

public void marshal(edu.gmu.streams.BlockOutputStream output) throws java.io.IOException{
    request.marshal(output);
    output.writeInt( this.hosts.size() );
    for (int i = 0; i < hosts.size(); i++)
    {
        Host host = hosts.get(i);
        host.marshal(output);
    }
}

public void unmarshal(edu.gmu.streams.BlockInputStream input) throws java.io.IOException{
    request = new ListManagerRequest();
    request.unmarshal(input);
    int hostsSize = input.readInt();
    this.hosts = new ArrayList<Host>();
    for (int i = 0; i < hostsSize; i++)
    {
        Host host = new Host();
        host.unmarshal(input);
        this.hosts.add(host);
    }
}
}
